<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="../static/css/reset.css">
    <link rel="stylesheet" type="text/css" href="../static/css/login-register.css">
    <script type="text/javascript" src="../static/js/jquery.min.js"></script>
</head>

<body>
    <div id="header">
        <div class="flex-header">
            <span class="flex title">登录</span>
        </div>
    </div>
    <form action="" method="post" id="login-register">
        <label for="number">
            <input type="text" name="number" placeholder="学号" id="number">
        </label>
        <label for="password">
            <input type="password" name="password" placeholder="密码" id="password">
        </label>
        <button class="lr-button">登录</button>
        <a href="" class="lr-button">注册</a>
    </form>
    <script type="text/javascript">
    $(document).ready(function() {
        $("form").submit(function(event) {
            event.preventDefault();
            $.ajax({
                    url: '/login',
                    type: 'post',
                    data: {
                        number: $("#number").val(),
                        password:$("#password").val()
                    },
                })
                .done(function(data) {
                    console.log(data);
                })
                .fail(function() {
                    console.log("error");
                })
                .always(function() {
                    console.log("complete");
                });

        });
    })
    </script>
</body>
</html>